home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
GameKit
/
Headers
/
gamekit
/
HighScoreSlot.h
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
63 lines
// HighScoreSlot.h -- this is a slot in the table and holds all the info
// about a particular high score. Future versions may hold more data
// and the only fields that *must* have valid data are pos and score.
// This class makes use of the DAYMiscKit which contains several classes
// that are of general use and not gamekit specific. (DAYString, DAYTime,
// and DAYStopwatch are used by HighScoreSlot.)
#import <appkit/appkit.h>
#define GKHighScoreSlot_VERSION 1
@interface HighScoreSlot:Object <NXTransport>
{
// The vars simply hold data about an instance of game play.
// This objects holds a record of info for easy transport over
// the net and easy saving and reading to and from files.
int finalScore, startLevel, endLevel; // basic info about game
id startTime, endTime; // DAYTime (DAYMiscKit)
id elapsedTime; // DAYStopwatch (DAYMiscKit)
id playerName, userName, machineName; // DAYString (DAYMiscKit)
}
+ initialize; // sets the version number of the class
- init; // same as [xxx initName:"Nobody" score:0];
- initName:(const char *)initName // another initializer, same as
score:(int)initScore; // [xxx initName:"Nobody" score:0 endLevel:0];
- initName:(const char *)initName score:(int)initScore
endLevel:(int)initLevel; // designated initializer
- dumpToLog:aLogFile; // used by server when logging
// The following methods access value of the slot.
- (const char *)playerName; // the scoring player's name
- (const char *)userName; // the scoring player's login name
- (const char *)machineName; // the machine used to play the game
- (int)finalScore; // score achieved
- (int)startLevel; // level game began at
- (int)endLevel; // level game reached
- startTime; // Date and time when game began
- endTime; // Date and time when game finished
- elapsedTime; // Length of time game play was actually in
// progress (ie. excluding paused periods)
// The following methods change the values of the slot. All return self.
- setPlayerName:(const char *)t;
- setUserName:(const char *)t;
- setMachineName:(const char *)t;
- setFinalScore:(int)t;
- setStartLevel:(int)t;
- setEndLevel:(int)t;
- setStartTime:aTime; // aTime is _not_ copied, so don't free it!
- setEndTime:aTime; // rather, aTime will be freed by the slot
- setElapsedTime:aTime; // so treat it as "handing off" the object
- (BOOL)isAbove:aSlot; // return YES if should be before aSlot in the table
// for archiving to/from a file
- read:(NXTypedStream *)stream;
- write:(NXTypedStream *)stream;
- copy;
@end